package com.easyExcel.controller;

import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.read.builder.ExcelReaderBuilder;
import com.alibaba.excel.read.builder.ExcelReaderSheetBuilder;
import com.easyExcel.entity.User;
import com.easyExcel.listener.UserListener;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * easyExcelTest
 *
 * @author byc
 * @date 2022-01-11
 */
@RestController
@RequestMapping("/easyExcel")
public class easyExcelTest {

    @GetMapping("/read")
    public void read(){
        ExcelReaderBuilder readBook= EasyExcel.read("C:\\Users\\admin\\Desktop\\人员表.xlsx", User.class,new UserListener());
        ExcelReaderSheetBuilder sheet = readBook.sheet();
        sheet.doRead();
    }

    @GetMapping("/aaa")
    public String aaa(){
        return "aaa";
    }
}
